package cn.sgjk.train.business.controller.admin;


import cn.sgjk.train.common.context.LoginMemberContext;
import cn.sgjk.train.common.resp.CommonResp;
import cn.sgjk.train.common.resp.PageResp;
import cn.sgjk.train.business.req.DailyTrainSeatQueryReq;
import cn.sgjk.train.business.req.DailyTrainSeatSaveReq;
import cn.sgjk.train.business.resp.DailyTrainSeatQueryResp;
import cn.sgjk.train.business.service.DailyTrainSeatService;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/daily-train-seat")
public class DailyTrainSeatAdminController {

    private static final Logger LOG = LoggerFactory.getLogger(DailyTrainSeatAdminController.class);
    @Autowired
    private DailyTrainSeatService dailyTrainSeatService;



    @PostMapping("/save")
    public CommonResp<Object> save(@Valid @RequestBody DailyTrainSeatSaveReq dailyTrainSeatReq) {
        dailyTrainSeatService.save(dailyTrainSeatReq);
        return new CommonResp<>();
    }



    @GetMapping("/query-list")
    public CommonResp<PageResp<DailyTrainSeatQueryResp>> query(@Valid DailyTrainSeatQueryReq dailyTrainSeatQueryReq) {
        PageResp<DailyTrainSeatQueryResp> dailyTrainSeatQueryResps = dailyTrainSeatService.queryList(dailyTrainSeatQueryReq);
        return new CommonResp<>(dailyTrainSeatQueryResps);
    }

    @DeleteMapping("/delete/{id}")
    public CommonResp<Object> delete(@PathVariable Long id) {
        dailyTrainSeatService.delete(id);
        return new CommonResp<>();
    }
}

